#include <limits.h>
#include "graph.hh"
#include "construct_greedy_randomized_solution.hh"
#include "local_search_neighborhood_randomly.hh"
#include "local_search_key_path.hh"
#include "utilis.hh"
using namespace std;

int test_path(int argc, char *argv[])
{
	Path * path1 = new Path();
	for(int i=0; i<15; i++)
		path1->path->push_front(i);
	cout << "Path1" << endl;
	PrintPath(path1);


	Path * path2 = new Path();
	for(int i=2; i<6; i++)
		path2->path->push_back(i);
	path2->path->push_back(10);
	cout << "Path2" << endl;
	PrintPath(path2);


	Path * path3 = new Path();
	for(int i=2; i<8; i++)
		path3->path->push_front(i);
	path3->path->push_front(14);
	cout << "Path3" << endl;
	PrintPath(path3);

	Path * path5 = new Path();
	for(int i=2; i<20; i++)
		path5->path->push_front(i);
	cout << "Path5" << endl;
	PrintPath(path5);


	Path * path6 = new Path();
	path6->path->push_front(2);
	for(int i=0; i<2; i++)
		path6->path->push_front(i);
	path6->path->push_front(19);
	cout << "Path6" << endl;
	PrintPath(path6);

	Path * path7 = new Path();
	path7->path->push_back(7);
	path7->path->push_back(3);
	path7->path->push_back(16);
	cout << "Path7" << endl;
	PrintPath(path7);

	Path * path8 = new Path();
	for(int i=2; i<20; i++)
		path8->path->push_front(i);
	cout << "Path8" << endl;
	PrintPath(path8);


	cout << "path1 is empty: " << path1->IsEmpty() << endl;
	cout << "path1 contiene node 0: " << path1->Contains(0) << endl;
	cout << "path1 contiene node 10: " << path1->Contains(10) << endl;
	cout << "path1 contiene node 14: " << path1->Contains(14) << endl;
	cout << "path1 contiene node 15: " << path1->Contains(15) << endl;
	cout << "path1 contiene arista (13, 14): " << path1->Contains(new pair<int,int>(13, 14)) << endl;
	cout << "path1 contiene arista (0, 1): " << path1->Contains(new pair<int,int>(0, 1)) << endl;
	cout << "path1 contiene arista (10, 9): " << path1->Contains(new pair<int,int>(10, 9)) << endl;
	cout << "path1 contiene arista (9, 10): " << path1->Contains(new pair<int,int>(9, 10)) << endl;
	cout << "path1 contiene arista (26, 10): " << path1->Contains(new pair<int,int>(26, 10)) << endl;

	cout << "path1 contiene path1: " << path1->Contains(path1) << endl;
	cout << "path1 contiene path2: " << path1->Contains(path2) << endl;
	cout << "path1 contiene path3: " << path1->Contains(path3) << endl;
	cout << "path2 contiene path3: " << path2->Contains(path3) << endl;
	cout << "path1 contiene path6: " << path1->Contains(path6) << endl;
	cout << "path1 contiene path5: " << path1->Contains(path5) << endl;
	cout << "path5 contiene path3: " << path5->Contains(path3) << endl;

	cout << "SubPath(0, 1)" << endl;
	Path * path4 = path1->SubPath(0, 1);
	PrintPath(path4);
	delete path4;

	cout << "SubPath(14, 13)" << endl;
	path4 = path1->SubPath(14, 13);
	PrintPath(path4);
	delete path4;

	cout << "SubPath(6, 5)" << endl;
	path4 = path1->SubPath(6, 5);
	PrintPath(path4);
	delete path4;

	cout << "SubPath(2, 13)" << endl;
	path4 = path1->SubPath(2, 13);
	PrintPath(path4);
	delete path4;

	cout << "SubPath(13, 2)" << endl;
	path4 = path1->SubPath(13, 2);
	PrintPath(path4);
	delete path4;

	cout << "SubPath(0, 14)" << endl;
	path4 = path1->SubPath(0, 14);
	PrintPath(path4);
	delete path4;

	cout << "path1->Replace(path2, 2, 10)" << endl;
	path1->Replace(path2, 2, 10);
	PrintPath(path1);

	cout << "path5->Replace(path3, 2, 14);" << endl;
	path5->Replace(path3, 2, 14);
	PrintPath(path5);

	cout << "path5->Replace(path6, 7, 16);" << endl;
	path5->Replace(path7, 7, 16);
	PrintPath(path5);

	cout << "path5->Replace(path6, 2, 19);" << endl;
	path5->Replace(path6, 2, 19);
	PrintPath(path5);

	cout << "path5->Replace(path8, 2, 19);" << endl;
	path5->Replace(path8, 2, 19);
	PrintPath(path8);

	return 0;
}
